package com.example.hibernate;

import com.example.hibernate.dto.UserInfo;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;

public class HibernateTest {

    public static void main(String[] args) {
        UserInfo userInfo = new UserInfo();
        userInfo.setUserId(1);
        userInfo.setUserName("First User");

        SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
        Session hbSession = sessionFactory.openSession();

        hbSession.beginTransaction();
        hbSession.save(userInfo);
        hbSession.getTransaction().commit();


    }
}
